package com.hardy.leecode;

import java.util.Deque;
import java.util.LinkedList;
import java.util.Stack;

/**
 * Author: Hardy
 * Date:   2020/6/30
 * Description:
 **/
public class QueOffer09 {

    public static void main(String[] args) {

    }

    static class CQueue {

        Deque<Integer> s1;
        Deque<Integer> s2;

        public CQueue() {
            s1 = new LinkedList<>();
            s2 = new LinkedList<>();
        }

        public void appendTail(int value) {
            s1.push(value);
        }

        public int deleteHead() {
            if (s2.isEmpty()) {
                if (s1.isEmpty()) return -1;

                while (!s1.isEmpty()) {
                    s2.push(s1.pop());
                }
            }
            return s2.pop();
        }
    }
}
